<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
    return view('welcome');
});

Route::group(['prefix' => 'post'], function() {
    Route::get('/detail/{id}','PostController@detail')->where('id', '[0-9]+');;
    Route::get('/index','PostController@index');
    Route::get('/edit/{id}','PostController@edit');
    Route::put('/editSubmit/{id}','PostController@editSubmit');
    Route::get('/del/{id}','PostController@del');
    Route::get('/create','PostController@create');
    Route::any('/create/submit','PostController@createSubmit');
    Route::any('/uploadImage','PostController@uploadImage');

    Route::any('/{post}/comment','CommentController@submitComment');
    Route::any('zan','PostController@zan');


});

/*Route::group(['prefix' => 'post'], function() {
    Route::get('/{id}','PostController@detail');
    Route::get('/index',function(){dd(1);});
    Route::get('/edit/{id}','PostController@edit');
//    Route::put('/editSubmit/{id}','PostController@editSubmit');
    Route::get('/del/{id}','PostController@del');
    Route::get('/create','PostController@create');
    Route::any('/create/submit','PostController@createSubmit');
    Route::any('/uploadImage','PostController@uploadImage');
});*/


Route::group(['prefix' => 'login'], function() {
    Route::get('/index','LoginController@index');
    Route::post('/login','LoginController@login');
});

Route::group(['prefix' => 'register'], function() {
    Route::get('/index','RegisterController@index');
    Route::post('/register','RegisterController@register');
});

Route::get('/logout','LoginController@logout');


//    个人中心模块
Route::any('/user/{user}','UserController@index');